An online patch refers to a patch taking effect in a running program without restarting the program. For a multi-core processor, a current multi-core central processing unit (CPU) with a hardware memory management unit (MMU) supports an online patching function. In an environment of a multi-core CPU, operations such as loading and activation of the online patch are implemented by a master core.
As shown in FIG. 1, in the patch loading operation of the multi-core CPU, the master core obtains a patch, puts the patch to a cache, parses the patch, extracts code segments and data segments of the patch, and loads the patch according to a logic address. The MMU of the hardware implements the mapping from the logic address to a physical address, and maps core private data to each private data segment in a patch area of a shared memory.
In the process of implementing the present invention, the inventors find that, under an MMU condition, because each core in the multi-core CPU accesses the same logic address, and the logic address is mapped to different physical addresses in the patch area, shared global variables of the multi-core CPU cannot be mapped.